<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>自动渲染问题</title>
  <script src="../js/vue.js"></script>
  <style>
    * {
      padding: 0;
      margin: 0;
      box-sizing: border-box;
    }

    body,
    html {
      height: 100%;
      height: 100%;
    }

    ul {
      list-style: none;
    }

    .father {
      display: flex;
      width: 80%;
      height: 100px;
      margin: auto;
      border: 2px solid red;
    }

    .father>ul {
      flex: 1;
      margin: 10px auto;
      text-align: center;
    }

    .father>ul>li {
      font: normal normal 1.5rem "微软雅黑";
    }

    .father>ul>li:last-of-type {
      margin-top: 10px;
    }

    .son {
      text-align: center;
      margin-top: 20px;
    }

    .son>input {
      outline: 0;
      font: normal normal 2rem "微软雅黑";
      background: none;
      border: 2px solid red;
      padding: 8px 10px;
      border-radius: 5px;
    }

    .son>input:hover {
      cursor: pointer;
    }
  </style>
</head>

<body>
  <!-- 当数组或对象内的成员发生改变时，是不会重新渲染的 -->
  <div id="app">
    <div class="father">
      <ul v-for="items in list" :key="items.id">
        <li>{{items.name.names}}</li>
        <li>{{items.age}}</li>
      </ul>
    </div>
    <div class="son">
      <input type="button" value="点击" @click="handle">
    </div>
  </div>
</body>
<script>
  const app = new Vue({
    el: "#app",
    data() {
      return {
        list: [{
          id: 0,
          name: {
            names: "强哥"
          },
          age: 24
        }, {
          id: 1,
          name: {
            names: "好的了"
          },
          age: 20
        }, {
          id: 2,
          name: {
            names: "小茶"
          },
          age: 19
        }]
      };
    },
    methods: {
      handle() {
        this.list[0].name.names = "cgc";
      }
    }
  });
</script>

</html>